package com.jthinker.bean.enu;

/**
 * Created by chen.gang on 15-2-22.
 */
public enum SortOrder implements Dict
{
    ASC(0, "升序"), DESC(1, "降序");

    SortOrder(int key, String text)
    {
        this.key = key;
        this.text = text;
    }

    private int key;
    private String text;

    @Override
    public int getKey()
    {
        return key;
    }

    @Override
    public String getText()
    {
        return text;
    }

    public static final SortOrder parse(String raw)
    {
        for (SortOrder sortOrder : SortOrder.values())
        {
            if (sortOrder.toString().equalsIgnoreCase(raw))
            {
                return sortOrder;
            }
        }

        return ASC;
    }
}
